/**
 * @file main.cpp
 * @author 张奕欣 (3190105655@zju.edu.cn)
 * @brief 
 * @version 0.1
 * @date 2022-12-07
 * 
 * @copyright Copyright (c) 2022
 * 
 */

#include "graph.h"
#include <string>
#include <vector>
#include <list>
using namespace std;

int main()
{
    /**
     * @brief 测试邻接矩阵
     * 
     */
    vector<graphVertex<string>> V;
    vector<graphEdge<string>> E;

    graphVertex<string> v1{"A"};
    graphVertex<string> v2{"B"};
    graphEdge<string> edge1{v1, v2, 7};
    
    V.push_back(v1);
    V.push_back(v2);
    E.push_back(edge1);

    cout << "*****Test adMatrix:*****" << endl;
    cout << "listEdges, listVertexes" << endl;
    GraphAdMatrix<string> G{V, E};
    G.listEdges();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    G.listVertexes();

    cout << "addEdges, addVertexes" <<endl;
    graphVertex<string> v3{"C"};
    graphEdge<string> edge2{v2, v3, 2};
    G.addgraphVertex(v3);                                                                                                                                                                                                                                                                                                                                                      
    G.addgraphEdge(edge2);

    G.listEdges();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    G.listVertexes();
    
    /**
     * @brief 测试邻接列表
     * 
     */
    cout << "*****Test adList:*****" << endl;
    GraphAdList<string> G2{V, E};
    cout << "listEdges, listVertexes" <<endl;
    G2.listEdges();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    G2.listVertexes();

    cout << "addEdges, addVertexes" <<endl;
    cout << "if no weight, weight = 1" << endl;
    graphVertex<string> v4{"D"};
    graphEdge<string> edge3{v2, v4};
    G2.addgraphVertex(v4);                                                                                                                                                                                                                                                                                                                                                      
    G2.addgraphEdge(edge3);

    G2.listEdges();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    G2.listVertexes();

}